import { defineStore } from 'pinia'

const usePaintStore = defineStore({
  // 这里的id必须为唯一ID
  id: 'usePaintStore',
  state: () => {
    return {
      curWorkInfo: null
    }
  },
  // 等同于vuex的getter
  getters: {},
  // pinia 放弃了 mutations 只使用 actions
  actions: {
    // actions可以用async做成异步形式
    // async setCurWork(work: ApiPainting.TalkDetail) {
    //   this.curWorkInfo = work
    // }
  },
  // 持久化
  persist: {
    key: 'ai-painting-web-paint',
    storage: window.sessionStorage
    // storage: window.localStorage
  }
})

export default usePaintStore
